const bodyParser =require('body-parser')
const {data}=require('./src/mock/index')
module.exports={
    devServer:{
        before:app=>{
            app.use(bodyParser.json())
            app.post('/api/carList',(req,res)=>{
                res.send({
                    code:200,
                    data
                })
            })
            app.post('/api/detail',(req,res)=>{
                let {id,index}=req.body
                console.log(req.body)
                let details=data[index].car.find(item=>item.id===id)
                res.send({
                    code:300,
                    data:details
                })
            })
        }
    }
}